/*
 * @Author: Clark
 * @Email: haixuanwoTxh@gmail.com
 * @Date: 2023-01-04 15:00:51
 * @LastEditors: Clark
 * @LastEditTime: 2023-01-04 15:02:03
 * @Description: file content
 */

#include "apue.h"
#include <fcntl.h>

void set_fl(int fd, int flags)
{
    int val = -1;

    val = fcntl(fd, F_GETFL, 0);
    if (val < 0)
    {
        err_sys("fcntl F_GETFL error");
    }

    val |= flags;

    if (fcntl(fd, F_SETFL, val) < 0)
    {
        err_sys("fcntl F_SETFL error");
    }
}
